#ifndef ITEM_H_INCLUDED
#define ITEM_H_INCLUDED

struct BITMAP;
class  Player;

class Item {
public:
    enum Type {
        ITEM_ARMET =  0,
        ITEM_ROBE =   1,
        ITEM_WEAPON = 2,

        ITEM_HP_POSITION = 7,

        WHERE_GROUND = 0,
        WHERE_INVENTORY = 1,
        WHERE_BODY = 2,

        USE_REMOVE = 0,
        USE_FAILED = 1,
        USE_REMAIN = 2,
    };

    Item(Type t, BITMAP *inv) : m_type(t), m_where(WHERE_INVENTORY), m_tile_inv(inv), m_tile_body(inv) {}
    Item(Type t, BITMAP *inv, BITMAP *body) : m_type(t), m_where(WHERE_INVENTORY), m_tile_inv(inv), m_tile_body(body) {}

    void        toBody(bool flag) { m_where = (flag ? WHERE_BODY : WHERE_INVENTORY); }
    void        setMapPos(short x, short y) { m_where = WHERE_GROUND; m_mapx = x, m_mapy = y; }
    inline int  getEquipPos() const { return (int)m_type; }
    bool        canEquip() const;
    Type        use(Player *player);

    void draw(BITMAP *surface, short x, short y);

private:
    Type    m_type;
    Type    m_where;
    BITMAP *m_tile_inv;
    BITMAP *m_tile_body;
    short   m_mapx, m_mapy;
};


#endif // ITEM_H_INCLUDED
